#ifndef __SYNTAX_TREE__
#define __SYNTAX_TREE__

typedef enum SYN_TYPE{
	SYN_MIN_TYPE,
	SYN_CONST,
	SYN_ID,
	SYN_OP,
	SYN_MAX_TYPE
}SYN_TYPE;

typedef struct opType
{
    int type;
	int chno;
	struct syntax_tree ** children;
} opType;
typedef struct idType
{
    char *name;
}idType;
typedef struct constType
{
    int value;
}constType;


typedef struct syntax_tree
{
	SYN_TYPE type;
	union {
		constType con;
		idType id;
		opType op;
	};
} *syntax_t;

syntax_t syntax_t_new(int type,int chno,...);
syntax_t syntax_t_const(int value);
syntax_t syntax_t_id(const char* name);
syntax_t syntax_t_get(syntax_t tree,int no);
void syntax_t_delete(syntax_t tree);
void syntax_t_print(syntax_t tree);

#endif
